<template>
  <div class="sticker-content-container">
    <img v-show="imageLoaded === false" @click="preview(message)"
         v-bind:src="'data:video/jpeg;base64,' + message.messageContent.thumbnail">
    <img v-show="imageLoaded" @click="preview(message)" @load="onImageLoaded"
         v-bind:src="message.messageContent.remotePath">
  </div>
</template>

<script>
import Message from "@/wfc/messages/message";

export default {
  name: "StickerMessageContentView",
  props: {
    message: {
      type: Message,
      required: true,
    }
  },
  data() {
    return {
      imageLoaded: false,
    }
  },
  methods: {
    preview(message) {
      // TODO
      console.log('TODO, preview sticker collection');
    },
    onImageLoaded() {
      this.imageLoaded = true
    }
  }
}
</script>

<style lang="css" scoped>
.sticker-content-container {
  margin: 0 10px;
  position: relative;
  border: 1px solid #efefef;
  border-radius: 5px;
}

.sticker-content-container img {
  max-height: 200px;
  max-width: 200px;
  border-radius: 5px;
  overflow: hidden;
}

.right-arrow:before {
  border-left-color: white;
}

.left-arrow:before {
  border-left-color: white;
}

</style>
